Skip to content

feat(studio): reopen the last closed query tab - #767

Open
2160039878-cyber wants to merge 1 commit into
libredb:mainfrom
2160039878-cyber:feat/reopen-closed-query-747
Open

feat(studio): reopen the last closed query tab#767
2160039878-cyber wants to merge 1 commit into
libredb:mainfrom
2160039878-cyber:feat/reopen-closed-query-747

Conversation

@2160039878-cyber

@2160039878-cyber 2160039878-cyber commented Sep 9, 2026

Copy link
Copy Markdown

Description

Accidentally closing an unsaved query can now be undone with the "Reopen last closed tab" button next to the new-tab button. It restores the last closed tab's name, text and query language in both Studio and StudioWorkspace, without adding a close confirmation.

Closes #747.

Changes Made

  • Keep one closed-tab snapshot in the shared tab manager, scoped to the current connection and cleared after reopening or switching connections.
  • Reopen with a fresh ID and cleared execution state so a late response from the closed tab cannot overwrite the restored query.
  • Keep the existing last-tab safeguard and active-tab fallback. Preserve queued updates to other tabs during close.
  • Add an accessible, disabled-when-unavailable reopen control and document the recovery lifetime: until another tab closes, the connection changes, or the page reloads.

Testing

  • TDD: three recovery regressions failed before implementation.
  • bun run test:hooks --isolate --pass-with-no-tests -t 'useTabManager': 35 passed.
  • Project-isolated component run targeting StudioTabBar: 29 passed.
  • Passed locally: format, lint, typecheck, knip, readme:check, chart:check, channels:showcase:check, security:check. The final functional-state-update adjustment was followed by the 35-test hook run and diff review.
  • build, build:lib and attw passed on clean commit fb284404db49839c867a78fbb81551780294a6b2.
  • Full local bun run test, coverage and app E2E were not run: this Windows host lacks Helm/chart dependencies and working Docker; existing SQLite cleanup also encounters Windows file locks. CI must verify the full suite and 100% line coverage.

Environment: Windows, Node.js 24.18.1, Bun 1.4.2.

Checklist

  • Claimed and linked the issue, reviewed the diff, updated documentation and added regression tests.
  • Required CI test job passes the 100% line-coverage gate.

Additional Notes

AI-assisted implementation and validation using Codex. Recovery is an in-memory single-tab history; query results and in-flight execution are intentionally not restored. No dependencies, persistence-format changes or provider changes.

@codecov

codecov Bot commented Sep 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Closing a tab loses its query with no way to undo it

1 participant